package com.ocr.demo;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import java.io.InputStream;
public class CS {
    public static void main11(String[] args) {
       /* String message="{\"msg\":\"\",\"results\":[{\"data\":[{\"confidence\":0.984186053276062,\"text\":\"姓名肖鹏\",\"text_box_position\":[[758,1381],[1377,1347],[1384,1480],[765,1514]]},{\"confidence\":0.9324826598167419,\"text\":\"性别男民族汉\",\"text_box_position\":[[773,1576],[1676,1576],[1676,1692],[773,1692]]},{\"confidence\":0.9195139408111572,\"text\":\"出生1995年4月18日\",\"text_box_position\":[[778,1765],[1890,1779],[1889,1882],[777,1868]]},{\"confidence\":0.9917235374450684,\"text\":\"住址\",\"text_box_position\":[[781,1984],[1021,1984],[1021,2075],[781,2075]]},{\"confidence\":0.838249146938324,\"text\":\"湖北省十堰市勋阳区五峰\",\"text_box_position\":[[1075,1989],[2100,1984],[2100,2070],[1075,2075]]},{\"confidence\":0.991769015789032,\"text\":\"乡肖家河村1组119号\",\"text_box_position\":[[1088,2118],[1974,2113],[1974,2203],[1088,2208]]},{\"confidence\":0.9310042858123779,\"text\":\"公民身份号码420321199504187217\",\"text_box_position\":[[789,2479],[2793,2470],[2793,2569],[790,2577]]}],\"save_path\":\"\"}],\"status\":\"000\"}";
        JSONObject jsonObject = JSONUtil.parseObj(message);
        JSONArray results =jsonObject.getJSONArray("results");
        JSONObject datas =results.getJSONObject(0);
        JSONArray datalist=datas.getJSONArray("data");
        for (int i = 0; i < datalist.size(); i++) {
            String text=datalist.getJSONObject(i).getStr("text");
            System.out.println(text);
        }*/


            try {
                InputStream inputStream = CS.class.getClassLoader().getResourceAsStream("hot.properties");
                Properties properties = new Properties();
                properties.load(inputStream);
                for (String key : properties.stringPropertyNames()) {
                    String value = properties.getProperty(key);
                    value = new String(value.getBytes("ISO-8859-1"), "UTF-8");
                    System.out.println("Key: " + key + ", Value: " + value);
                }

            } catch (Exception e) {
                e.printStackTrace();
            }
        }

    public static void main(String[] args) {
        String str1 = "Hello [worasdasdald]!";
        String str2 = "[";
        String str3 = "]";

        int startIndex = str1.indexOf(str2);
        if (startIndex != -1) {
            startIndex += str2.length(); // 跳过起始字符串
            int endIndex = str1.indexOf(str3, startIndex);
            if (endIndex != -1) {
                String result = str1.substring(startIndex, endIndex);
                System.out.println(result);
            }
        }
    }

}
